package com.ustudy.entity.sns;

import java.util.Collections;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.ustudy.core.dao.support.entity.LongIdEntity;

/**
 * 板块分类
 * @author caizh
 *
 */
@SuppressWarnings("serial")
@Entity(name="ForumClassification")
@Table(name="SNS_FORUM_CLASSIFICATION")
public class ForumClassification extends LongIdEntity {
	
	private String name;
	
	private Long sortInfo=System.currentTimeMillis();
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="P_ID")
	private ForumClassification parent;
	
	@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="parent")
	private List<ForumClassification> children=Collections.emptyList();

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getSortInfo() {
		return sortInfo;
	}

	public void setSortInfo(Long sortInfo) {
		this.sortInfo = sortInfo;
	}

	public ForumClassification getParent() {
		return parent;
	}

	public void setParent(ForumClassification parent) {
		this.parent = parent;
	}

	public List<ForumClassification> getChildren() {
		return children;
	}

	public void setChildren(List<ForumClassification> children) {
		this.children = children;
	}

}
